﻿using System;
using System.IO;
using System.Web;
using Framework;

namespace Enterprise.Admin.Handle
{
    /// <summary>
    /// 移除企业荣誉图片 不删除资料
    /// </summary>
    public partial class RemoveHonorPicture : AdminBasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            object result;
            try
            {
                var path = HttpContext.Current.Server.MapPath("~/Upload/Honor/");
                var normalImage = Fq("CoNormalImage").SafeToString();
                var smallImage = Fq("CoSmallImage").SafeToString();
                var bigImage = Fq("CoBigImage").SafeToString();
                FileHelper.DeleteSub(Path.Combine(path, normalImage));
                FileHelper.DeleteSub(Path.Combine(path, smallImage));
                FileHelper.DeleteSub(Path.Combine(path, bigImage));
                int id = Fq("CoHonorId").SafeToInt();
                var honorService = new HonorService();
                honorService.DeletePicture(id);
                result = (new { state = true, message = "删除成功！" });
            }
            catch (Exception ex)
            {
                result = (new { state = false, message = ex.Message });
            }
            Json(result);


        }
    }
}